﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SiGeSIB.Data.Security;
using SiGeSIB.Data.Management;
using SiGeSIB.Data.Finances;

namespace SiGeSIB.Data.Providers
{
	public interface IDataProvider
	{
		IManagementDataProvider CreateManagementDataProvider();
		ISecurityDataProvider CreateSecurityDataProvider();
		IBackupRestorationDataProvider CreateBackupDataProvider();
		IFinancesDataProvider CreateFinancesDataProvider();
	}
	public interface IManagementDataProvider
	{
		int InsertContributor(Contributor contributor);
		void UpdateContributor(Contributor contributor);
		void RemoveContributor(int id);

		Member GetMember(int id);
		List<Member> GetMembers();
		List<Member> GetMembers(int[] ids);

		Contributor GetContributor(int id);
		List<Contributor> GetContributors(EContributorType type);
		List<Contributor> GetContributors(int[] ids);

		Dictionary<string, Address> GetAddresses();
	}

	public interface ISecurityDataProvider
	{
		User GetUser(string login);
		List<User> GetUsers(int[] ids);

		int InsertUser(User user);
		void UpdateUser(User user);
		void RemoveUser(int id);

		EPermissions GetUserPermission(int userId);
		void SaveUserPermission(int userId, EPermissions permission);
	}

	public interface IBackupRestorationDataProvider
	{
		void Backup(string fileName);
		void RestoreBackup(string fileName);
	}

	public interface IFinancesDataProvider
	{
		int InsertMovimentation(Movimentation movimentation);
		void UpdateMovimentation(Movimentation movimentation);
		void RemoveMovimentation(int id);

		int InsertCostCenter(CostCenter center);
		void UpdateCostCenter(CostCenter center);
		void RemoveCostCenter(int id);

		CostCenter GetCostCenter(int id, CostCenterInfo info);
		List<CostCenter> GetCostCenters(CostCenterInfo info);
		List<CostCenter> GetCostCenters(int[] ids, CostCenterInfo info);

		Movimentation GetMovimentation(int id);
		List<Movimentation> GetMovimentations(MovimentationFilter filter, MovimentationInfo info);
	}
}
